package router

import (
	"github.com/gin-gonic/gin"
	"react-blog-server/app/api"
	"react-blog-server/common/middleware"
	"react-blog-server/config"
)

func InitRouter(cfg *config.Config) *gin.Engine {
	engine := gin.Default()
	group := engine.Group("/v1/api/blog")

	api.NewAuthHttp(group)
	api.NewSquareHttp(group)

	group.Use(middleware.CheckJWTAuthMiddleware())
	api.NewArticleHttp(group)
	api.NewUserHttp(group)
	return engine
}
